<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>新增上报协调信息</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/editor/wangEditor.min.js" type="text/javascript"></script>
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <script src="/static/js/editor/wangEditor.min.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" method="post" style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;">
    <!-- 编辑框START-->
    <div id="editform" class="form mini-fit" style="margin: 10px 0 40px;">
        <input id="id" name="id" class="mini-hidden" style="width: 100%;" value="${id!''}" />
        <input name="create_user" class="mini-hidden" style="width: 100%;" value="${create_user!''}" />
        <input name="addgovid" class="mini-hidden" style="width: 100%;" value="${addgovid!''}" />
        <input name="updanwei" class="mini-hidden" style="width: 100%;" value="${updanwei!''}" />
        <input name="jglevel" class="mini-hidden" style="width: 100%;" value="${jglevel!''}" />
        <input name="tip_flag" class="mini-hidden" style="width: 100%;" value="${tip_flag!''}" />
        <table class="form-table" align="center" cellspacing="8">
            <tr>
                <td><font color="#dc143c">*</font>标题:</td>
                <td>
                    <input name="title" id="title" class="mini-textbox" style="width: 200px" required="true" maxlength="25"/>
                </td>
                <td><font color="#dc143c">*</font>上报类型:</td>
                <td>
                    <input name="sbtype" id="sbtype" class="mini-combobox" style="width: 200px" required="true"
                           textField="codeName" valueField="codeId" emptyText="请选择..."
                           url="/azbj/shzzgl/socialOrgInfo/getComboboxData?codeType=3_9"
                    />
                </td>
            </tr>
            <tr>
                <td style="vertical-align:text-top;"><font color="#dc143c">*</font>内容:</td>
                <td colspan="3">
                    <div id="content" name="content" style="width: 480px;">
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <!--编辑框END-->
    <div style="position: absolute;bottom: 0;line-height: 40px;width: 100%;border-top:1px solid #dfdfdf;text-align: center">
        <a class="mini-button" iconCls="fa-save" plain="true" onclick="saveData()">保存</a>
        <a class="mini-button" iconCls="fa-undo" plain="true" onclick="onCancel()">取消</a>
    </div>
</form>
<script type="text/javascript">
    mini.parse();
    var E = window.wangEditor;
    var editor = new E('#content');
    editor.customConfig.menus = [
        'head',  // 标题
        'bold',  // 粗体
        'fontSize',  // 字号
        'fontName',  // 字体
        'italic',  // 斜体
        'foreColor',  // 文字颜色
        'backColor',  // 背景颜色
        'link',  // 插入链接
        'justify',  // 对齐方式
        'image',  // 插入图片
        'undo',  // 撤销
        'redo'  // 重复
    ];
    editor.customConfig.uploadImgShowBase64 = true;
    // 隐藏“网络图片”tab
    editor.customConfig.showLinkImg = false;
    editor.customConfig.zIndex = 100;
    editor.create();
    var form = new mini.Form("form1");
    var addgovid = mini.getByName("addgovid").getValue();
    var updanwei = mini.getByName("updanwei").getValue();
    var jglevel = mini.getByName("jglevel").getValue();
    var create_user = mini.getByName("create_user").getValue();
    var tip_flag = mini.getByName("tip_flag").getValue();

    //标准方法接口定义
    function SetData(data) {
        if (data.name) {
            mini.get("name").setEnabled(false);
            mini.get("sex").setEnabled(false);
            mini.get("birthday").setEnabled(false);
            mini.get("idNumber").setEnabled(false);
            mini.get("originPlace").setEnabled(false);
        }
        if (data.releaseDate) {
            mini.get("releaseDate").setEnabled(false);
            mini.get("releaseReason").setEnabled(false);
            mini.get("releaseRemark").setEnabled(false);
            $("#applybtn").attr("style", "display:none;");
        }

        var o = mini.decode(data);
        form.setData(o);
        form.setChanged(false);
        var o = mini.decode(data);
        form.setData(o);
        form.setChanged(false);
        editor.txt.html(data.content);
    }

    function saveData() {
        if (editor.txt.text().length == 0) {
            mini.alert("内容不能为空");
            return;
        }
        //验证非空字段
        form.validate();
        if (form.isValid() == false) {
            return;
        }
        var data = form.getData();
        var content = editor.txt.html();
        var id = mini.get("id").getValue();
        if (!id) {
            id = ${id!''};
        }
        data.id = id;
        data.content = content;
        data.addgovid = addgovid;
        data.updanwei = updanwei;
        data.jglevel = jglevel;
        data.create_user = create_user;
        data.tip_flag = tip_flag;
        var json = mini.encode(data);

        commonSaveData("/azbj/sbxtgl/reportInfoManage/save", {data: json}, callback);
        // 保存成功的回调函数
        function callback() {
            mini.alert("保存成功", "成功", window.CloseOwnerWindow);
        }
    }
</script>
</body>
</html>